/*
package com.kavin.collection.rocketmq;

import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.stereotype.Service;

*/
/**
 * @ClassName producer
 * @Description
 * @Author kavin
 * @Date 2022/8/17 17:29
 * @Version 1.0
 *//*

@Service
public class Producer {

    @Autowired
    RocketMQTemplate rocketMQTemplate;

    //同步消息
    public void sendMsg(){
        SendResult re = rocketMQTemplate.syncSend("kavin:msg2", "测试重试");
        System.out.println(re);
    }


    //异步消息
    public void sendAsyncMsg(){
        rocketMQTemplate.asyncSend("kavin:msg2", "异步消息", new SendCallback() {
            @Override
            public void onSuccess(SendResult sendResult) {
                System.out.println("异步消息发送成功结果：" + sendResult);
            }

            @Override
            public void onException(Throwable throwable) {
                System.out.println("异步消息发送异常：" + throwable.getMessage());
            }
        });
    }


    //延迟消息
    public void sendDeloyMsg(){
        Message message = new GenericMessage("延时消息");
        rocketMQTemplate.syncSend("kavin:msg1", message,3000,3);
    }


}
*/
